home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / magict_1 / simplewe.frm < prev    next >
Text File  |  1999-07-22  |  16KB  |  747 lines

  1. VERSION 5.00
  2. Object = "{3035B5D2-295D-11D3-8C54-006008BA8D16}#1.0#0"; "MAGICTCP.OCX"
  3. Begin VB.Form Form1 
  4.    Caption         =   "Form1"
  5.    ClientHeight    =   8010
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   10080
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   8010
  11.    ScaleWidth      =   10080
  12.    StartUpPosition =   3  'Windows-Standard
  13.    Begin VB.CheckBox chkSubdirs 
  14.       Caption         =   "Enable Subdirectories"
  15.       Height          =   255
  16.       Left            =   8040
  17.       TabIndex        =   25
  18.       Top             =   240
  19.       Width           =   1935
  20.    End
  21.    Begin VB.CommandButton cmdSave 
  22.       Caption         =   "Save Config"
  23.       Height          =   495
  24.       Left            =   8040
  25.       TabIndex        =   24
  26.       Top             =   1200
  27.       Width           =   1455
  28.    End
  29.    Begin VB.TextBox txtLog 
  30.       Height          =   2655
  31.       Left            =   240
  32.       MultiLine       =   -1  'True
  33.       ScrollBars      =   2  'Vertikal
  34.       TabIndex        =   22
  35.       TabStop         =   0   'False
  36.       Top             =   5280
  37.       Width           =   9735
  38.    End
  39.    Begin VB.TextBox txtPhysical 
  40.       Height          =   405
  41.       Index           =   7
  42.       Left            =   3960
  43.       TabIndex        =   21
  44.       Top             =   4560
  45.       Width           =   3615
  46.    End
  47.    Begin VB.TextBox txtVirtual 
  48.       Height          =   405
  49.       Index           =   7
  50.       Left            =   240
  51.       TabIndex        =   20
  52.       Top             =   4560
  53.       Width           =   3615
  54.    End
  55.    Begin VB.TextBox txtPhysical 
  56.       Height          =   405
  57.       Index           =   6
  58.       Left            =   3960
  59.       TabIndex        =   19
  60.       Top             =   4080
  61.       Width           =   3615
  62.    End
  63.    Begin VB.TextBox txtVirtual 
  64.       Height          =   405
  65.       Index           =   6
  66.       Left            =   240
  67.       TabIndex        =   18
  68.       Top             =   4080
  69.       Width           =   3615
  70.    End
  71.    Begin VB.TextBox txtPhysical 
  72.       Height          =   405
  73.       Index           =   5
  74.       Left            =   3960
  75.       TabIndex        =   17
  76.       Top             =   3600
  77.       Width           =   3615
  78.    End
  79.    Begin VB.TextBox txtVirtual 
  80.       Height          =   405
  81.       Index           =   5
  82.       Left            =   240
  83.       TabIndex        =   16
  84.       Top             =   3600
  85.       Width           =   3615
  86.    End
  87.    Begin VB.TextBox txtPhysical 
  88.       Height          =   405
  89.       Index           =   4
  90.       Left            =   3960
  91.       TabIndex        =   15
  92.       Top             =   3120
  93.       Width           =   3615
  94.    End
  95.    Begin VB.TextBox txtVirtual 
  96.       Height          =   405
  97.       Index           =   4
  98.       Left            =   240
  99.       TabIndex        =   14
  100.       Top             =   3120
  101.       Width           =   3615
  102.    End
  103.    Begin VB.TextBox txtPhysical 
  104.       Height          =   405
  105.       Index           =   3
  106.       Left            =   3960
  107.       TabIndex        =   13
  108.       Top             =   2640
  109.       Width           =   3615
  110.    End
  111.    Begin VB.TextBox txtVirtual 
  112.       Height          =   405
  113.       Index           =   3
  114.       Left            =   240
  115.       TabIndex        =   9
  116.       Top             =   2640
  117.       Width           =   3615
  118.    End
  119.    Begin VB.TextBox txtPhysical 
  120.       Height          =   405
  121.       Index           =   2
  122.       Left            =   3960
  123.       TabIndex        =   8
  124.       Top             =   2160
  125.       Width           =   3615
  126.    End
  127.    Begin VB.TextBox txtVirtual 
  128.       Height          =   405
  129.       Index           =   2
  130.       Left            =   240
  131.       TabIndex        =   7
  132.       Top             =   2160
  133.       Width           =   3615
  134.    End
  135.    Begin VB.TextBox txtPhysical 
  136.       Height          =   405
  137.       Index           =   1
  138.       Left            =   3960
  139.       TabIndex        =   6
  140.       Top             =   1680
  141.       Width           =   3615
  142.    End
  143.    Begin VB.TextBox txtVirtual 
  144.       Height          =   405
  145.       Index           =   1
  146.       Left            =   240
  147.       TabIndex        =   5
  148.       Top             =   1680
  149.       Width           =   3615
  150.    End
  151.    Begin VB.TextBox txtPhysical 
  152.       Height          =   405
  153.       Index           =   0
  154.       Left            =   3960
  155.       TabIndex        =   4
  156.       ToolTipText     =   "Corresponding physical path for virtual path to the left"
  157.       Top             =   1200
  158.       Width           =   3615
  159.    End
  160.    Begin VB.TextBox txtVirtual 
  161.       Height          =   405
  162.       Index           =   0
  163.       Left            =   240
  164.       TabIndex        =   3
  165.       ToolTipText     =   "Virtual path"
  166.       Top             =   1200
  167.       Width           =   3615
  168.    End
  169.    Begin VB.CommandButton cmdStart 
  170.       Caption         =   "Start!"
  171.       Default         =   -1  'True
  172.       Height          =   495
  173.       Left            =   8040
  174.       TabIndex        =   23
  175.       Top             =   4440
  176.       Width           =   1455
  177.    End
  178.    Begin VB.TextBox txtPort 
  179.       Height          =   375
  180.       Left            =   600
  181.       TabIndex        =   0
  182.       ToolTipText     =   "TCP port where to listen"
  183.       Top             =   240
  184.       Width           =   855
  185.    End
  186.    Begin VB.TextBox txtAccessList 
  187.       Height          =   375
  188.       Left            =   2760
  189.       TabIndex        =   2
  190.       ToolTipText     =   "Comma separeted list of ip adresses containing wild card '*'"
  191.       Top             =   240
  192.       Width           =   4815
  193.    End
  194.    Begin M3LibCtl.MagicTCP M1 
  195.       Left            =   8400
  196.       OleObjectBlob   =   "SimpleWeb.frx":0000
  197.       Top             =   2520
  198.    End
  199.    Begin VB.Line Line2 
  200.       X1              =   120
  201.       X2              =   9960
  202.       Y1              =   5160
  203.       Y2              =   5160
  204.    End
  205.    Begin VB.Label Label4 
  206.       Caption         =   "Phsical Path"
  207.       Height          =   255
  208.       Left            =   3960
  209.       TabIndex        =   12
  210.       Top             =   960
  211.       Width           =   3135
  212.    End
  213.    Begin VB.Label Label3 
  214.       Caption         =   "Virtual Path"
  215.       Height          =   255
  216.       Left            =   240
  217.       TabIndex        =   11
  218.       Top             =   960
  219.       Width           =   3135
  220.    End
  221.    Begin VB.Line Line1 
  222.       X1              =   120
  223.       X2              =   9960
  224.       Y1              =   840
  225.       Y2              =   840
  226.    End
  227.    Begin VB.Label Label2 
  228.       Caption         =   "Access List"
  229.       Height          =   375
  230.       Left            =   1800
  231.       TabIndex        =   10
  232.       Top             =   240
  233.       Width           =   855
  234.    End
  235.    Begin VB.Label Label1 
  236.       Caption         =   "Port"
  237.       Height          =   255
  238.       Left            =   240
  239.       TabIndex        =   1
  240.       Top             =   240
  241.       Width           =   375
  242.    End
  243. End
  244. Attribute VB_Name = "Form1"
  245. Attribute VB_GlobalNameSpace = False
  246. Attribute VB_Creatable = False
  247. Attribute VB_PredeclaredId = True
  248. Attribute VB_Exposed = False
  249. Option Explicit
  250.  
  251. Const MAX_VPATHS = 8
  252.  
  253. Dim ServerSocket As Long
  254. Dim ServerPort As Long
  255. Dim AccessList As String
  256. Dim serverSubdirs As Long
  257.  
  258.  
  259. Dim vPath(1 To 8) As String ' our virtual paths
  260. Dim pPath(1 To 8) As String ' corresponding physical paths
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269. Sub CloseSocket()
  270.  
  271. With M1
  272.     If .zzState >= 0 Then
  273.         Close .zzState
  274.     End If
  275.     
  276.     .Delete .CurrentSocket
  277. End With
  278.  
  279. End Sub
  280.  
  281. Sub HttpError(c As Integer, t As String)
  282.  
  283. ' return an http error
  284.  
  285. Dim s As String
  286. Dim r As String
  287. Dim n As Long
  288.  
  289. With M1
  290.     r = "Error: " & t
  291.     s = "HTTP/1.0 " & CStr(c) & " " & t & vbCrLf
  292.     s = s & "Content-Type: text/plain" & vbCrLf
  293.     s = s & "Content-Length: " & CStr(Len(r)) & vbCrLf
  294.     s = s & vbCrLf
  295.     s = s & r
  296.     
  297.     n = .WriteString(s)
  298.     If (n > 0) And (n < Len(s)) Then
  299.         .zzBuffer = Mid$(s, n + 1)
  300.     End I